#include "app_includes.h"
#include "gui.h"

void gui_timer_refresh(lv_timer_t *timer)
{
    uint32_t color[] = {0x00B4B4, 0xC31111, 0x3EF33A, };
    char value_str[32];
    if(solder.temp->invalid) {
        strcpy(value_str, "---");
    } else {
        uint_to_str(value_str, (uint32_t)solder.temp->value, 0, 3, NULL);
    }
    lv_label_set_text(ui_LabelSolderTemp, value_str);
    
    if(gun.temp->invalid) {
        strcpy(value_str, "---");
    } else {
        uint_to_str(value_str, (uint32_t)gun.temp->value, 0, 3, NULL);
    }
    lv_label_set_text(ui_LabelGunTemp, value_str);
    
    if(plate.temp->invalid) {
        strcpy(value_str, "---");
    } else {
        uint_to_str(value_str, (uint32_t)plate.temp->value, 0, 3, NULL);
    }
    lv_label_set_text(ui_LabelPlateTemp, value_str);
    
    float_to_str(value_str, app_dev.meter.power_out_v.value, 2, 5, NULL);   
    lv_label_set_text(ui_LabelPowerV,value_str);
    
    if(app_dev.ui_change.para_status==1) {
        app_dev.ui_change.para_status = 0;
        lv_obj_set_style_border_color(ui_PanelSolderTemp, lv_color_hex(color[app_dev.para.status.solder_work]), LV_PART_MAIN | LV_STATE_DEFAULT);
        lv_obj_set_style_border_color(ui_PanelGunTemp, lv_color_hex(color[app_dev.para.status.gun_work]), LV_PART_MAIN | LV_STATE_DEFAULT);
        lv_obj_set_style_border_color(ui_PanelPlateTemp, lv_color_hex(color[app_dev.para.status.plate_work]), LV_PART_MAIN | LV_STATE_DEFAULT);
        lv_obj_set_style_border_color(ui_PanelPowerTemp, lv_color_hex(color[app_dev.para.status.power_work]), LV_PART_MAIN | LV_STATE_DEFAULT);
    }
}

